<%@page import="com.is.util.Common"%>
<%@page import="com.is.export.control.SelectOptionValue"%>
<%@page import="java.util.LinkedHashMap"%>
<%@page import="com.is.control.DictationControl"%>
<%@page import="com.is.control.AttendanceDetailControl"%>
<%@page import="com.is.control.ParamClassControl"%>
<%@page import="com.is.model.ParamStuyear"%>
<%@page import="com.is.control.ParamStuyearControl"%>
<%@page import="com.is.control.CourseClassControl"%>
<%@page import="com.is.model.CourseClass"%>
<%@page import="java.util.List"%>
<%@page import="com.is.control.StudentControl"%>
<%@page import="com.is.model.Student"%>
<%@page import="com.is.util.ParamUtil"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="com.is.util.DesData"%>
<%@page import="com.is.control.ParamCourseControl"%>
<%@page import="com.is.export.model.Dic_HomeExport"%>
<%@page import="java.util.ArrayList"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../resources/css/user_info.css" />
<style type="text/css">
	#caption{height:30px; line-height:30px; text-align:left;padding-top:10px;}
	table thead tr th{background:#7BC671;}
</style>
<title>个人作业情况</title>
</head>
<body>
 <%
         // 单个学生所有课程出席情况
         DesData des = new DesData();
          String stu=ParamUtil.getString(request,"stuId");
         int stuId = Integer.parseInt(des.decrypt(stu));
         Student cs = StudentControl.getStudent(stuId);
         int classId = Integer.parseInt(cs.getClassId());
         int stuyear = ParamUtil.getInt(request,"stuyear",ParamStuyearControl.getCurrentStuyearId());
         List<CourseClass> ccs = CourseClassControl.getAllCourseClassIdByClassIdAndStuyear(classId,stuyear);
         ccs = Common.sortCourseClassName(ccs);
         List<Dic_HomeExport> exportList = new ArrayList<Dic_HomeExport>();
 %>
 <div id="add_info">
 <form action="allCoursesOneStu.jsp" method="post">
 <table>
 	<caption id="caption">请选择</caption>
	 <tr>
	 	<td style="height:36px;"><select name="stuyear">
			 <%
			         List<ParamStuyear> years = ParamStuyearControl.getAllStuyear();
			         for(ParamStuyear ps:years){
			 %>
			 <option value="<%=ps.getId() %>"  <%if(ps.getId()==stuyear)out.print("selected"); %>><%=ps.getStuyear() %></option>
			 <%} %>
			 </select>
	 	</td>
	 	<td>
	 		 <input type="hidden" value="<%=stu%>" name="stuId">
			<input type="submit" value="查询" />&nbsp;&nbsp;
			<input type="button" value="导出结果"  onclick="window.location.href='/InterStu/servlet/ExportDo'" />
	 	</td>
	 </tr>
</table>
 </form>
 <form>
 <table>
  <caption id="caption"> <%=cs.getChineseName() %>的听写情况</caption>
 <thead>
	 <tr>
		 <th>课程</th>
		 <th>A</th>
		 <th>B</th>
		 <th>C</th>
		 <th>D</th>
	 </tr>
 </thead>
 <%
         for(CourseClass cc:ccs){
        	 int A = DictationControl.getCount(stuId,"A",cc.getId(),stuyear,"","");
		     int B = DictationControl.getCount(stuId,"B",cc.getId(),stuyear,"","");
		     int C = DictationControl.getCount(stuId,"C",cc.getId(),stuyear,"","");
		     int D = DictationControl.getCount(stuId,"D",cc.getId(),stuyear,"","");
		     exportList.add(new Dic_HomeExport(cs.getChineseName(),ParamCourseControl.getCourseById(cc.getCourseId()).getCourseName(),A+"",B+"",C+"",D+""));
 %>
 <tr>
 <td><%=ParamCourseControl.getCourseById(cc.getCourseId()).getCourseName() %></td>
 <td><%=A %></td>
 <td><%=B %></td>
 <td><%=C %></td>
 <td><%=D %></td>
 </tr>
 <%}
    session.removeAttribute("exportList");
	 session.setAttribute("exportList",exportList);
	 session.removeAttribute("fileName");
	 session.setAttribute("fileName",cs.getChineseName()+ParamStuyearControl.getStuyear(stuyear).getStuyear()+"听写情况");
	 LinkedHashMap<String,String> exportOps = SelectOptionValue.Dic_HomeOptions();
	 session.removeAttribute("exportOps");
	 session.setAttribute("exportOps",exportOps);
	 session.removeAttribute("className");
	 session.setAttribute("className","com.is.export.model.Dic_HomeExport");
 %>
 </table>
 <br/>
 </form>
 </div>
</body>
</html>